import store from '../../store/store'
import { INCREMENTCOUNT, DECREMENTCOUNT } from "../constant/countConstant"

// 累加
export const incrementAction = (data = 1) => {
  return {
    type: INCREMENTCOUNT,
    data
  }
}

// 累减
export const decrementAction = (data = 1) => {
  return {
    type: DECREMENTCOUNT,
    data
  }
}

// 异步action
export const waitdecrementAction = (data) => {
  return () => {
    setTimeout(() => {
      store.dispatch({
        type: INCREMENTCOUNT,
        data
      })
    }, 2000)
  }
}